package com.rd.student.ruanjian.class4.baiyunyao.DAY0728;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

class xuesheng implements Comparable<xuesheng>{

    private static Object xuesheng;
    private String name;
    private Integer chinese;
    private Integer math;
    private Integer english;
    private Integer score;

    public xuesheng(String name, Integer chinese, Integer math, Integer english, Integer score) throws IOException {
        this.name = name;
        this.chinese = chinese;
        this.math = math;
        this.english = english;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getChinese() {
        return chinese;
    }

    public void setChinese(Integer chinese) {
        this.chinese = chinese;
    }

    public Integer getMath() {
        return math;
    }

    public void setMath(Integer math) {
        this.math = math;
    }

    public Integer getEnglish() {
        return english;
    }

    public void setEnglish(Integer english) {
        this.english = english;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "com.rd.student.ruanjian.class4.baiyunyao.DAY0728.xuesheng{" +
                "name='" + name + '\'' +
                ", chinese=" + chinese +
                ", math=" + math +
                ", english=" + english +
                ", score=" + score +
                '}';
    }




    @Override
    public int compareTo(xuesheng o) {

            return o.score-this.score;
        }
    static class xueshengTest {
        public static void main(String[] args) {
            Set<xuesheng> set=new TreeSet<xuesheng>();
            Scanner scanner=new Scanner(System.in);
            for (int i = 0; i < 3 ; i++) {
                System.out.println("请输入学生姓名");
                String name=scanner.next();
                System.out.println("请输入学生语文成绩");
                int chinese=scanner.nextInt();
                System.out.println("请输入学生数学成绩");
                int math=scanner.nextInt();
                System.out.println("请输入学生英语成绩");
                int english=scanner.nextInt();
                int score=chinese+math+english;

            }
            for (xuesheng s:set) {
                System.out.println(s);
            }
        }
    }
    public static void main(String[] args) throws Exception{
    File file = new File("Student.txt");
    Writer writer = new FileWriter(file);
    Object content = xuesheng;
        writer.write((char[]) content);
        writer.close();
    }
}


